/**
 * Created by VoledyDing on 2017/4/21.
 */
export default {
    //时间戳转时间格式
    fmtDate:(value)=>{
        let month,day,hours,minutes;
        let myDate = new Date(value*1000);
        let year = myDate.getFullYear();
        let Mmonth = myDate.getMonth() + 1;
        let Dday = myDate.getDate();
        let Hhours = myDate.getHours();
        let Mminutes = myDate.getMinutes();
        Mmonth.toString().length < 2 ? month = '0' + Mmonth:month = Mmonth; 
        Dday.toString().length < 2 ? day = '0' + Dday:day = Dday; 
        Hhours.toString().length < 2 ? hours = '0' + Hhours:hours = Hhours;
        Mminutes.toString().length < 2 ? minutes = '0' + Mminutes:minutes = Mminutes; 
        return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes;
    },
    //时间戳转月日
    mdDate:(value)=>{
        let month,day;
        let myDate = new Date(value*1000);
        let Mmonth = myDate.getMonth() + 1;
        let Dday = myDate.getDate();
        Mmonth.toString().length < 2 ? month = '0' + Mmonth:month = Mmonth; 
        Dday.toString().length < 2 ? day = '0' + Dday:day = Dday; 
        return month + '-' + day;
    },

    //时间戳转时分
    hmDate:(value)=>{
        let hours,minutes;
        let myDate = new Date(value*1000);
        let Hhours = myDate.getHours();
        let Mminutes = myDate.getMinutes();
        Hhours.toString().length < 2 ? hours = '0' + Hhours:hours = Hhours;
        Mminutes.toString().length < 2 ? minutes = '0' + Mminutes:minutes = Mminutes; 
        return hours + ':' + minutes;
    },
    
    //保留两位小数
    nubFixed:(value)=>{
        return parseFloat(value).toFixed(2);
    },

    //买卖 转换
    tradeType:(value)=>{
        var type = '';
        return value == 1 ? type = '买':type = '卖';
    },

    //挂单 支付方式
    payType:(value)=>{
        var type = '';
        switch(parseInt(value)){
            case 1:
                type = '微信';
                break;
            case 2:
                type = '支付宝';
                break;
            case 3:
                type = '银行卡';
                break;
        };
        return type;
    },

    //挂单 联系方式
    contactType:(value)=>{
        var type = '';
        switch(parseInt(value)){
            case 1:
                type = '微信';
                break;
            case 2:
                type = '支付宝';
                break;
            case 3:
                type = '手机号';
                break;
        };
        return type;
    },
}